<!DOCTYPE html>
<!--conf
<sample>
              <product version="4.0b1" edition="std"/>
                     <modifications>
                            <modified date="130911"/>
                     </modifications>
               </sample>
-->
<html>
<head>
	<title>ButtonTwoState state</title>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<link rel="stylesheet" type="text/css" href="../../../codebase/dhtmlx.css"/>
	<script src="../../../codebase/dhtmlx.js"></script>
	<script>
		var sel;
		var myToolbar;
		function doOnLoad() {
			sel = document.getElementById("sel");
			myToolbar = new dhtmlXToolbarObject({
				parent: "toolbarObj",
				icons_path: "../common/imgs/",
				xml: "../common/dhxtoolbar_button2state.xml",
				onload: updateList
			});
		}
		function getId() {
			var id = sel.options[sel.selectedIndex].value;
			return id;
		}
		function enable() {
			var id = getId();
			myToolbar.enableItem(id);
		}
		function disable() {
			var id = getId();
			myToolbar.disableItem(id);
		}
		function isEnabled() {
			var id = getId();
			alert(myToolbar.isEnabled(id));
		}
		function updateList() {
			sel.options.length = 0;
			myToolbar.forEachItem(function(itemId){
				if (myToolbar.getType(itemId) == "buttonTwoState") {
					sel.options.add(new Option(myToolbar.getItemText(itemId), itemId));
				}
			});
		}
	</script>
</head>
<body onload="doOnLoad()">
	<div id="toolbarObj"></div>
	<div style="margin-top: 20px;">
		<select id="sel"></select>
		<input type="button" value="Enable" onclick="enable();">
		<input type="button" value="Disable" onclick="disable();">
		<input type="button" value="Is Enabled" onclick="isEnabled();">
	</div>
</body>
</html>